class SessionsController < ApplicationController
	def	new
		@user = User.new
		render 'sign_in'
	end

	# url: 10.10.10.154:3000/sign_in
	# params structure to sign_in:
	# user[user_name]='admin'
	# user[password]='123456'
	def create
		puts "params = #{params.inspect}"
		sign_in(params[:user][:user_name], params[:user][:password])
		puts "current_user = #{current_user}"
		respond_to do |format|
	      if current_user	        	        
	        format.json { render :json => current_user}
	      else	        
	        format.json { render :json => {:error_msg => 'no current_user'}}
	      end
	    end  
	end

	def destroy
		sign_out
		render :json => 'success'
	end
end
